package com.cskaoyan.javase.annotation._4config;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;

/**
 * 服务端
 * @since 11:39
 * @author wuguidong@cskaoyan.onaliyun.com
 */
@TCPConfigAnno(port = 9999)
public class Server {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ServerSocket serverSocket = new ServerSocket(TCPUtils.getDefaultPort("com.cskaoyan.javase.annotation._4config.Server"));
        Socket socket = serverSocket.accept();
        InputStream in = socket.getInputStream();
        byte[] buf = new byte[1024];
        int readCount = in.read(buf);
        System.out.println(new String(buf, 0, readCount));
        serverSocket.close();
    }
}
